package com.loren.demo13.utils;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.Getter;

import java.io.Serializable;
import java.util.List;

/**
 * 针对MyBatis-Plus的分页工具
 */
@Getter
public class MPage<T> implements Serializable {

    private static final long serialVersionUID = -6518424048053226824L;

    private final long page;

    private final long size;

    private final long pages;

    private final long total;

    private final List<T> list;

    public MPage(Page<T> pageInfo) {
        this.page = pageInfo.getCurrent();
        this.size = pageInfo.getSize();
        this.pages = pageInfo.getPages();
        this.total = pageInfo.getTotal();
        this.list = pageInfo.getRecords();
    }
}
